﻿using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using System;

namespace Sustainalytics.Entities
{
    [Serializable]
    public class User : IEntity
    {
        public Guid Id { get; set; }

        public string Email { get; set; }

        public string FullName { get; set; }

        public string FirstName { get; set; }

        public string MiddleName { get; set; }

        public string LastName { get; set; }

        public DateTime ModifiedOn { get; set; }

        [BsonRepresentation(BsonType.String)]
        public Status Status { get; set; }

        public Guid? AccountId { get; set; }

        public string Account { get; set; }

        public bool IsLegalAgreementAccepted { get; set; }
      
        #region Sync Properties

        public SyncUserState Sync_SyncState { get; set; }

        public Status Sync_DiscretStatus { get; set; }

        public bool Sync_IsPlatformUser { get; set; }

        /// <summary>
        /// Holds the account status when there is an account associated with the user and the account has platform access granted.
        /// </summary>
        public Status Sync_AccountStatus { get; set; }

        public bool Sync_IsDeleted { get; set; }

        public DateTime SyncOn { get; set; }

        public bool Sync_IsActive { get; set; }

        public bool Sync_IsDirty { get; set; }

        public bool IsFakeIpUser { get; set; }

        [BsonIgnoreIfNull]
        public FirstTimeUser FirstTimeUserAccepted { get; set; }
        #endregion
    }

    public enum SyncUserState
    {
        Syncronized,
        PartialyInSync,
    }

    public class FirstTimeUser
    {
        [BsonIgnoreIfNull]
        public bool IsRiskRatingAccepted { get; set; }

        [BsonIgnoreIfNull]
        public bool IsSustainableProductsAccepted { get; set; }
    }
}
